<!DOCTYPE html>

<html lang="en-US">
<@common.header/>

<body class="page-sub-page page-listing-lines page-search-results" id="page-top">
<!-- Wrapper -->
<div class="wrapper">
    <!-- Navigation -->
   <@common.nav/><!-- /.navigation -->
    <!-- end Navigation -->
    <!-- Page Content -->
    <div id="page-content">
        <!-- Breadcrumb -->
        <div class="container">
            <ol class="breadcrumb">
                <li><a href="#">Home</a></li>
                <li class="active">房产列表</li>
            </ol>
        </div>
        <!-- end Breadcrumb -->


        <form role="form" onsubmit="return false">
            <div class="container">
                <div class="row">
                    <!-- Results -->
                    <div class="col-md-9 col-sm-9">
                        <section id="results">
                            <header><h1>房产列表</h1></header>
                            <section id="search-filter">
                                <figure><h3><i class="fa fa-search"></i>搜索结果:</h3>
                                    <span class="search-count"></span>
                                    <div class="sorting">
                                        <div class="form-group">
                                            <select id="orderBy" name="orderBy">
                                                <option value="house_price asc">排序</option>
                                                <option value="house_price asc">价格由低到高</option>
                                                <option value="house_price desc">价格由高到低</option>
                                                <option value="create_time desc">最近发布</option>
                                            </select>

                                        </div><!-- /.form-group -->
                                    </div>
                                </figure>
                            </section>
                            <div id="properties" class="display-lines">
                                <#list pageInfo.list as house>
                                    <div class="property">
                                        <figure class="tag status"></figure>
                                        <div class="property-image">
                                            <figure class="ribbon">In Hold</figure>
                                            <a href="/house/detail?houseId=${house.houseId}">
                                                <img alt="" src="${house.houseImages}"
                                                     style="width: 260px;height: 195px">
                                            </a>
                                        </div>

                                        <div class="info" style="height: 270px;width: 183px;">
                                            <header>
                                                <a href="/house/detail?houseId=${house.houseId}">
                                                    <h3>${house.houseName}</h3>
                                                </a>
                                                <figure>${house.houseAddress}</figure>

                                            </header>
                                            <div class="tag price">￥${house.housePrice} 万</div>
                                            <aside>
                                                <p>${house.houseRemark}
                                                </p>

                                                <dl>
                                                    <dt>房屋状态:</dt>
                                                    <dd>Sale</dd>
                                                    <dt>住房面积:</dt>
                                                    <dd>${house.houseArea} m<sup>2</sup></dd>
                                                    <dt>住房间数:</dt>
                                                    <dd>${house.houseBeds}</dd>
                                                    <dt>卫生间数:</dt>
                                                    <dd>${house.houseBaths}</dd>
                                                </dl>
                                            </aside>
                                            <a href="/house/detail?houseId=${house.houseId}" class="link-arrow">浏览详情</a>
                                        </div>
                                    </div>
                                </#list>

                            </div>


                            <div>
                                <ul class="pagination"
                                    style="display: block;width: 50%; margin: 0 auto;position: relative;">
                                        <#if pageInfo.hasPreviousPage>
                                            <li>
                                                <a href=${"/house/list?type=${type}&orderBy=${orderBy}&keyword=${keyword}&pageNum=${pageInfo.prePage}"}>&laquo;</a>
                                            </li>
                                        </#if>
                                        <#list pageInfo.navigatepageNums as page>
                                             <li><a href=${"/house/list?type=${type}&orderBy=${orderBy}&keyword=${keyword}&pageNum=${page}"}>${page}</a></li>
                                        </#list>
                                        <#if pageInfo.hasNextPage>
                                            <li><a href=${"/house/list?type=${type}&orderBy=${orderBy}&keyword=${keyword}&pageNum=${pageInfo.nextPage}"}>&raquo;</a></li>
                                        </#if>
                                </ul>
                            </div>
                    </div><!-- /.col-md-9 -->
                    <!-- end Results -->

                    <!-- sidebar -->
                    <div class="col-md-3 col-sm-3">
                        <section id="sidebar">
                            <aside id="edit-search">
                                <header><h3>搜索房屋资源</h3></header>
                                <form role="form" onsubmit="return false">

                                    <div class="form-group">
                                        <input type="text" class="form-control" id="houseName" value="${(vo.name)!}"
                                               name="name"
                                               placeholder="尝试输入小区名">
                                    </div>
                                    <div class="form-group">
                                        <select id="houseType" name="type">
                                            <option value="1">类型</option>
                                            <option value="1" <#if (vo.type)?? && (vo.type)==1> selected </#if> >售卖
                                            </option>
                                            <option value="2" <#if (vo.type)?? && (vo.type)==2> selected </#if> >出租
                                            </option>
                                        </select>
                                    </div><!-- /.form-group -->
                                    <input type="text" value="${(vo.sort)!}" name=sort hidden="true">

                                    <div class="form-group">
                                        <button type="submit" onclick="searchHouse()" class="btn btn-default">搜索
                                        </button>
                                    </div><!-- /.form-group -->
                                </form><!-- /#form-map -->
                            </aside><!-- /#edit-search -->


                        </section>
                    </div><!-- /.col-md-3 -->
                    <!-- end Sidebar -->
                </div><!-- /.row -->
            </div>
        </form><!-- /.container -->


    </div>
    <!-- end Page Content -->
    <!-- Page Footer -->
     <#--<@common.footer/>-->
    <!-- end Page Footer -->
</div>

<@common.js/>
<!--[if gt IE 8]>
<script type="text/javascript" src="/assets/js/ie.js"></script>
<![endif]-->
<script type="text/javascript">
    function searchHouse() {
        $(document).ready(function () {
            var houseName = $("#houseName").val();
            // alert(houseName);
            var houseType = $("#houseType").val();
            // alert(houseType)

            var orderBy = $("#orderBy").val();

            window.location.href = "/house/list?type=" + houseType + '&orderBy=' +orderBy + '&keyword=' + houseName
        })
    }
</script>

</body>
</html>